/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;

  // 首页
  router.get('/', controller.home.index);

  // API版本前缀
  const apiPrefix = '/api/v1';

  // 用户相关路由
  router.post(`${apiPrefix}/user/register`, controller.user.register);
  router.post(`${apiPrefix}/user/login`, controller.user.login);
  router.get(`${apiPrefix}/user/profile`, controller.user.profile);
  router.put(`${apiPrefix}/user/profile`, controller.user.updateProfile);
  router.post(`${apiPrefix}/user/change-password`, controller.user.changePassword);
  router.post(`${apiPrefix}/user/upload-avatar`, controller.user.uploadAvatar);
  router.get(`${apiPrefix}/user/preferences`, controller.user.getPreferences);
  router.post(`${apiPrefix}/user/preferences`, controller.user.updatePreferences);
  router.get(`${apiPrefix}/user/reminders`, controller.user.getReminders);
  router.post(`${apiPrefix}/user/reminders`, controller.user.updateReminders);
  router.get(`${apiPrefix}/user/buying-suggestions`, controller.user.getBuyingSuggestions);
  router.get(`${apiPrefix}/user/stats`, controller.user.getStats);

  // 衣服相关路由
  router.get(`${apiPrefix}/clothing`, controller.clothing.index);
  router.get(`${apiPrefix}/clothing/:id`, controller.clothing.show);
  router.post(`${apiPrefix}/clothing`, controller.clothing.create);
  router.put(`${apiPrefix}/clothing/:id`, controller.clothing.update);
  router.delete(`${apiPrefix}/clothing/:id`, controller.clothing.destroy);
  router.post(`${apiPrefix}/clothing/:id/images`, controller.clothing.uploadImages);
  router.post(`${apiPrefix}/clothing/:id/main-image`, controller.clothing.setMainImage);
  router.post(`${apiPrefix}/clothing/:id/favorite`, controller.clothing.toggleFavorite);
  router.post(`${apiPrefix}/clothing/:id/status`, controller.clothing.updateStatus);

  // 搭配相关路由
  router.get(`${apiPrefix}/outfit`, controller.outfit.index);
  router.get(`${apiPrefix}/outfit/:id`, controller.outfit.show);
  router.post(`${apiPrefix}/outfit`, controller.outfit.create);
  router.put(`${apiPrefix}/outfit/:id`, controller.outfit.update);
  router.delete(`${apiPrefix}/outfit/:id`, controller.outfit.destroy);
  router.post(`${apiPrefix}/outfit/:id/clothing`, controller.outfit.addClothing);
  router.delete(`${apiPrefix}/outfit/:id/clothing/:clothing_id`, controller.outfit.removeClothing);
  router.post(`${apiPrefix}/outfit/:id/favorite`, controller.outfit.toggleFavorite);
  router.post(`${apiPrefix}/outfit/:id/rate`, controller.outfit.rate);
  router.post(`${apiPrefix}/outfit/:id/copy`, controller.outfit.copy);
  router.post(`${apiPrefix}/outfit/:id/wear-today`, controller.outfit.wearToday);

  // 分类相关路由
  router.get(`${apiPrefix}/category`, controller.category.index);
  router.get(`${apiPrefix}/category/:id`, controller.category.show);
  router.post(`${apiPrefix}/category`, controller.category.create);
  router.put(`${apiPrefix}/category/:id`, controller.category.update);
  router.delete(`${apiPrefix}/category/:id`, controller.category.destroy);

  // 标签相关路由
  router.get(`${apiPrefix}/tag`, controller.tag.index);
  router.get(`${apiPrefix}/tag/active`, controller.tag.active);
  router.get(`${apiPrefix}/tag/type/:type`, controller.tag.byType);
  router.get(`${apiPrefix}/tag/:id`, controller.tag.show);
  router.post(`${apiPrefix}/tag`, controller.tag.create);
  router.put(`${apiPrefix}/tag/:id`, controller.tag.update);
  router.delete(`${apiPrefix}/tag/:id`, controller.tag.destroy);

  // 穿搭记录相关路由
  router.get(`${apiPrefix}/wear-record`, controller.wearRecord.index);
  router.get(`${apiPrefix}/wear-record/:id`, controller.wearRecord.show);
  router.post(`${apiPrefix}/wear-record`, controller.wearRecord.create);
  router.put(`${apiPrefix}/wear-record/:id`, controller.wearRecord.update);
  router.delete(`${apiPrefix}/wear-record/:id`, controller.wearRecord.destroy);

  // 统计相关路由
  router.get(`${apiPrefix}/stats/overview`, controller.stats.overview);
  router.get(`${apiPrefix}/stats/clothing`, controller.stats.clothing);
  router.get(`${apiPrefix}/stats/outfit`, controller.stats.outfit);
  router.get(`${apiPrefix}/stats/wear`, controller.stats.wear);

  // 推荐相关路由
  router.get(`${apiPrefix}/recommend/clothing`, controller.recommend.clothing);
  router.get(`${apiPrefix}/recommend/outfit`, controller.recommend.outfit);
  router.post(`${apiPrefix}/recommend/ai-match`, controller.recommend.aiMatch);

  // 智能推荐路由
  router.get(`${apiPrefix}/recommendation/weather-info`, controller.recommendation.getWeatherInfo);
  router.get(`${apiPrefix}/recommendation/smart`, controller.recommendation.getSmartRecommendations);
  router.get(`${apiPrefix}/recommendation/today`, controller.recommendation.getTodayRecommendations);
  router.get(`${apiPrefix}/recommendation/ai-style-analysis`, controller.recommendation.getAIStyleAnalysis);
  router.get(`${apiPrefix}/recommendation/ai-status`, controller.recommendation.checkAIStatus);
  router.get(`${apiPrefix}/recommendation/weather-based`, controller.recommendation.weatherBased);
  router.get(`${apiPrefix}/recommendation/occasion-based`, controller.recommendation.occasionBased);
  router.get(`${apiPrefix}/recommendation/color-based`, controller.recommendation.colorBased);
  router.get(`${apiPrefix}/recommendation/personal-based`, controller.recommendation.personalBased);
  router.get(`${apiPrefix}/recommendation/similar-user-based`, controller.recommendation.similarUserBased);
  router.post(`${apiPrefix}/recommendation/smart-outfit`, controller.recommendation.smartOutfit);
  router.get(`${apiPrefix}/recommendation/daily`, controller.recommendation.dailyRecommendation);
  router.post(`${apiPrefix}/recommendation/feedback`, controller.recommendation.recordFeedback);

  // 分析统计路由
  router.get(`${apiPrefix}/analysis/clothing-usage`, controller.analysis.clothingUsageFrequency);
  router.get(`${apiPrefix}/analysis/color-preference`, controller.analysis.colorPreferenceAnalysis);
  router.get(`${apiPrefix}/analysis/outfit-style`, controller.analysis.outfitStyleAnalysis);
  router.get(`${apiPrefix}/analysis/buying-suggestion`, controller.analysis.buyingSuggestionAnalysis);
  router.get(`${apiPrefix}/analysis/seasonal-wear`, controller.analysis.seasonalWearAnalysis);
  router.get(`${apiPrefix}/analysis/wardrobe-utilization`, controller.analysis.wardrobeUtilizationAnalysis);
  router.get(`${apiPrefix}/analysis/spending`, controller.analysis.spendingAnalysis);
  router.get(`${apiPrefix}/analysis/outfit-rating-trend`, controller.analysis.outfitRatingTrendAnalysis);
  router.get(`${apiPrefix}/analysis/comprehensive-report`, controller.analysis.comprehensiveReport);
  router.get(`${apiPrefix}/analysis/test-short-prompt`, controller.analysis.testShortPromptCall);

  // 提醒路由
  router.get(`${apiPrefix}/reminder`, controller.reminder.index);
  router.post(`${apiPrefix}/reminder`, controller.reminder.create);
  router.put(`${apiPrefix}/reminder/:id`, controller.reminder.update);
  router.delete(`${apiPrefix}/reminder/:id`, controller.reminder.destroy);
  router.post(`${apiPrefix}/reminder/:id/complete`, controller.reminder.markAsCompleted);
  router.get(`${apiPrefix}/reminder/today`, controller.reminder.todayReminders);
  router.post(`${apiPrefix}/reminder/laundry`, controller.reminder.createLaundryReminder);
  router.post(`${apiPrefix}/reminder/seasonal`, controller.reminder.createSeasonalReminder);
  router.post(`${apiPrefix}/reminder/shopping`, controller.reminder.createShoppingReminder);
  router.get(`${apiPrefix}/reminder/shopping-list`, controller.reminder.getShoppingList);
  router.put(`${apiPrefix}/reminder/shopping-list`, controller.reminder.updateShoppingList);

  // 社交分享路由
  router.post(`${apiPrefix}/social/share-outfit`, controller.social.shareOutfit);
  router.get(`${apiPrefix}/social/public-outfits`, controller.social.getPublicOutfits);
  router.post(`${apiPrefix}/social/outfit/:outfitId/like`, controller.social.likeOutfit);
  router.post(`${apiPrefix}/social/outfit/:outfitId/comment`, controller.social.commentOutfit);
  router.get(`${apiPrefix}/social/outfit/:outfitId/comments`, controller.social.getOutfitComments);
  router.post(`${apiPrefix}/social/user/:userId/follow`, controller.social.followUser);
  router.get(`${apiPrefix}/social/following`, controller.social.getFollowing);
  router.get(`${apiPrefix}/social/followers`, controller.social.getFollowers);
  router.get(`${apiPrefix}/social/friend-recommendations`, controller.social.getFriendRecommendations);
  router.get(`${apiPrefix}/social/feed`, controller.social.getFeed);
  router.post(`${apiPrefix}/social/report`, controller.social.reportContent);

  // 地理位置相关路由
  router.get(`${apiPrefix}/location/current`, controller.location.getCurrentLocation);
  router.post(`${apiPrefix}/location/geocode`, controller.location.geocode);
  router.post(`${apiPrefix}/location/reverse`, controller.location.reverseGeocode);
  router.get(`${apiPrefix}/location/cities`, controller.location.getCities);
  router.get(`${apiPrefix}/location/ip`, controller.location.getLocationByIP);
  router.get(`${apiPrefix}/location/search`, controller.location.searchLocation);

  // 文件上传路由
  router.post(`${apiPrefix}/upload/image`, controller.upload.image);
  router.post(`${apiPrefix}/upload/multiple`, controller.upload.multiple);
  router.delete(`${apiPrefix}/upload/:path`, controller.upload.delete);
};
